package com.hackordie.commons.software;

import com.hackordie.constants.ESoftwareType;

public class TextFile extends AProgram {

    private String[] textFile;
    
    public TextFile(String name, String contents, int size, int requiredRam,
            int requiredProcessor) {
        super(name, contents, size, ESoftwareType.textFile, requiredRam,
                requiredProcessor);
        
        textFile = new String[2];
    }  
   
    @Override
    public boolean run(Object[] obj){        
        textFile[0] = ((TextFile)obj[0]).getName();
        textFile[1] = ((TextFile)obj[0]).getDescription();
        return true;
    }
    
    //getter
    public String[] getOpenedTextFile() {
        return textFile;
    }

    @Override
    public boolean checkObj(Object[] obj) {
        if( !(obj.length == 1            &&
              obj[0] instanceof TextFile )) {
              return false;
          }
        return true;
    }
}
